/** @type {import('next').NextConfig} */
const nextConfig = {
  async redirects() {
    return [
      {
        source: '/admin',
        destination: '/admin/dashboard',
        permanent: true,
      },
      {
        source: '/admin/auth',
        destination: '/admin/auth/login',
        permanent: true,
      },
      {
        source: '/admin/login',
        destination: '/admin/auth/login',
        permanent: true,
      },
      {
        source: '/admin/register',
        destination: '/admin/auth/register',
        permanent: true,
      },
      {
        source: '/blogs',
        destination: '/blogs/all',
        permanent: true,
      }
    ];
  },
  async rewrites() {
    return [
      {
        source: '/sitemap-articles.xml',
        destination: '/api/sitemap/articles',
      },
      {
        source: '/sitemap-products.xml',
        destination: '/api/sitemap/products',
      },
      {
        source: '/sitemap-collections.xml',
        destination: '/api/sitemap/collections',
      },
      {
        source: '/sitemap-blogs.xml',
        destination: '/api/sitemap/blogs',
      }
    ];
  }
};

export default nextConfig;
